package com.nwcl.ysx.service.impl;

import com.nwcl.ysx.bo.RestaurantBO;
import com.nwcl.ysx.dao.RestaurantDao;
import com.nwcl.ysx.entity.Restaurant;
import com.nwcl.ysx.service.RestaurantService;
import com.nwcl.common.utils.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author liguiqin
 * @date 2023/5/25
 */
@Service
public class RestaurantServiceImpl implements RestaurantService {
    @Autowired
    private RestaurantDao restaurantDao;
    @Override
    public RestaurantBO getBySpaceId(Integer spaceId) {
        Restaurant restaurant=restaurantDao.getBySpaceId(spaceId);
        if(restaurant==null){
            return null;
        }
        return BeanUtil.copy(restaurant,RestaurantBO.class);
    }

    @Override
    public RestaurantBO getById(Integer id) {
        Restaurant restaurant=restaurantDao.getById(id);
        if(restaurant==null){
            return null;
        }
        return BeanUtil.copy(restaurant,RestaurantBO.class);
    }
}
